#! /bin/sh
# shell for smoothing a uniformly sampling velocity  and for generating a
# slowness perturbation
set -v


n1=251 r1=200 dz=10 fz=0 labelz="Depth (m)"
n2=161 r2=200 dx=25 fx=0 labelx="Midpoint (m)"
d1r=50 n1r=51 n2r=81 d2r=50 

# smooth velocity and resample
smooth3d<data.v r1=$r1 r2=$r2 d1=$dz d2=$dx n1=$n1 n2=$n2 n3=1 \
	verbose=1 iter=2 slowness=1>data.s
unisam2<data.s nx1=$n1 nx2=$n2 dx1=$dz dx2=$dx \
	 n1=$n1r n2=$n2r d1=$d1r d2=$d2r>vsfile

# calculate slowness perturbation, smooth it and resample it
# smoothing parameters here do not have to be the same as above ones
farith op=slowp in=data.v in2=data.s nz=$n1 nx=$n2 > data.tmp
smooth3d < data.tmp r1=100 r2=100 d1=$dz d2=$dx n1=$n1 n2=$n2 n3=1 \
	verbose=0 iter=2 vminc=-9999 slowness=0|
unisam2 nx1=$n1 nx2=$n2 dx1=$dz dx2=$dx \
	 n1=$n1r n2=$n2r d1=$d1r d2=$d2r>vpfile
	 
rm -f data.s
exit 0
